<!DOCTYPE html>
<html lang="en">
	<head>
		<title>pos</title>
		<#include "../inc/header.ftl"/>
	</head>

	<body class="no-skin">

		<div class="main-container ace-save-state" id="main-container">

			<div class="main-content">
				<div class="main-content-inner">

					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<table id="MainGrid"></table>
								<div id="toolbar">
									<div style="padding:8px">
                                        对账日期：<input id="paybankdt" class="easyui-datebox" style="width:140px">&emsp;
                                        <a href="#" onclick="javascript:searchInfo()" class="easyui-linkbutton" iconCls="icon-search">查 询</a>
                                        <a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="javascript:checkData()">内部对账</a>
                                    </div>
								</div>
							</div>
						</div><!-- /.row -->
					</div><!-- /.page-content -->
                </div>
			</div><!-- /.main-content -->
		</div><!-- /.main-container -->

		<!-- basic scripts -->
		<#include "../inc/basicjs.ftl"/>

		<!-- inline scripts related to this page -->
		<script type="text/javascript">
            //列表-------------------------------------------------
			jQuery(function($) {
                listPage();
			});

			function searchInfo() {
				listPage(prefix + '/bill/bankcheckbill/selbankincheck',1)
			}

            function listPage(url,mark){
			    if(mark==1){
                    var paybankdt = $('#paybankdt').val();
                }
                // 右侧表格
                $('#MainGrid').datagrid({
                    url:url,
                    pagination: true,
                    fitColumns:false,
                    striped: true,
                    singleSelect: false,
                    loadMsg: "正在加载数据，请稍后...",
                    queryParams: {paybankdt:paybankdt},
                    columns:[[
                        {title: '问题类型', field: 'type', width: 110,formatter: function(value,row,index){
                                return row.type == 1 ? '只存在银行' : '只存在河北非税';
                            }},
                        {title: '缴费类型',	field: 'paymenttype',width:120,formatter: function(value,row,index){
                                if(row.paymenttype==1) {
                                    return '一般缴款书电子票';
                                }else if(row.paymenttype==2) {
                                    return '一般缴款书手工票';
                                }else if(row.paymenttype==3) {
                                    return '交警罚没';
                                }else if(row.paymenttype==4) {
                                    return '小条缴费';
                                }else if(row.paymenttype==5) {
                                    return '化解国库';
                                }else if(row.paymenttype==6) {
                                    return '化解专户';
                                }else if(row.paymenttype==7) {
                                    return '化解分成';
                                }else if(row.paymenttype==8) {
                                    return '二八分成划转';
                                }else if(row.paymenttype==9) {
                                    return '退付书';
                                }else if(row.paymenttype==10) {
                                    return '跨省交罚';
                                }
                            }},
                        {title: '票号',	field: 'billnum',width:150},
                        {title: '银行网点', field: 'bankstation', width: 120},
                        {title: '对账时间', field: 'checkdate',width:150},
                        {title: '备注', field: 'memo', width: 100 }
                    ]],
                    toolbar: '#toolbar'
                });
                $(window).resize(function() {
                    $('#MainGrid').datagrid('resize');
                });
            }

            function checkData(){
                var paybankdt = $("#paybankdt").val();
                if(paybankdt==null || paybankdt==''){
                    $.messager.alert('提示', '请选择日期!', 'info');
                    return;
                }
                $.ajax({
                    url:prefix + "/bill/bankcheckbill/incheck",
                    type: 'POST',
                    data: {paybankdt:paybankdt},
                    success:function(data){
                        if(data.code=="000000"){
                            $.messager.alert('提示', '对账结束!', 'info');
                        }else{
                            $.messager.alert('提示', '对账失败!', 'info');
                        }
                    }
                });
            }

        </script>
	</body>
</html>
